import cv2 as cv
import numpy as np


def color_detect(image):
    hsv_image = cv.cvtColor(image, cv.COLOR_BGR2HSV)
    lo = np.array([0,50,50])
    up = np.array([20,255,255])
    mask = cv.inRange(hsv_image,lo,up)
    cv.imshow('mask', mask)
    dst = cv.bitwise_and(image,image,mask=mask)
    cv.imshow('dst',dst)


src = cv.imread('opencv-logo.png')
cv.namedWindow('demo',cv.WINDOW_AUTOSIZE)
cv.imshow('demo',src)
color_detect(src)
cv.waitKey(0)
cv.destroyAllWindows()